home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 31
/
Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso
/
Aminet
/
dev
/
gui
/
gui4cli.lha
/
Gui4Cli
/
G4C
/
FSearch
/
FSearch.gc
next >
Wrap
Text File
|
1999-04-21
|
16KB
|
653 lines
G4C
; $VER: FSearch.gc 1.1
; by D.Keletsekis 15/9/97
; GUI for the FSearch command
; You must have FSearch 1.1 in the guis:c/fsearch directory, or
; else change the paths given in the 2 Launch commands.
; This gui can be called as :
; GUILOAD guis:g4c/fsearch.gc SearchPath TextToFind
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
; Globals
;
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
WINBIG 103 22 409 159 'FSearch 1.1 by D.Keletsekis'
WinType 11110001
resinfo 8 660 270
varpath 'fsearch.ft' ; /dir.gc'
winout "kcon:0/100/690/170/FSearch Output/auto/close/wait"
BOX 2 13 406 128 OUT button
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
; System events
;
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
xOnLoad searchpath findtxt
setgad FSearch.gc 101 hide
setgad FSearch.gc 201/250 hide
setgad FSearch.gc 300/350 hide
setgad FSearch.gc 325/333 off ; size
setgad FSearch.gc 305/306 off ; date
GuiOpen FSearch.gc
; the default values
if $$ARG.0 > ''
searchpath = $$ARG.0
else
searchpath = sys:
endif
file = '#?'
subdirs = ALL
findtxt = ''
case = ''
strsearch = On
output = gui
format = 'VERBOSE'
nobin = ''
nopath = ''
details = ''
highlight = HL
min_size = ''
max_size = ''
from = ''
to = ''
header = ''
update fsearch.gc 2 $searchpath
update fsearch.gc 7 $findtxt
setgad fsearch.gc 7 on
; load the file types
lvuse fsearch.ft 1
lvchange :fsearch.types
xOnClose
GuiQuit FSearch.gc
GuiQuit fsearch.ft ; filetypes gui
GuiQuit fsearch.rmb
xONRMB
if $guimode = RES
guiopen fsearch.rmb
endif
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
; Gui Mode cycler
;
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; ---- a cycler to change the gui to its various modes
XCYCLER 2 0 186 13 "" guimode
gadhelp 'Click to change the GUI mode - use "m" for shortcut'
gadid 500
gadkey m ; use 'm' to cycle it
CStr "FSearch Parameters" PAR
CStr "FSearch Settings" SET
cstr "Date, Size & Type" DATE
cstr "FSearch Results" RES
gosub FSearch.gc guichange
xroutine guichange
docase $guimode
case = PAR
setgad FSearch.gc 1/13 show
setgad FSearch.gc 21/24 show
setgad FSearch.gc 101 hide
setgad FSearch.gc 300/350 hide
setgad FSearch.gc 201/250 hide
break
case = SET
setgad FSearch.gc 1/13 hide
setgad FSearch.gc 21/24 hide
setgad FSearch.gc 101 hide
setgad FSearch.gc 300/350 hide
setgad FSearch.gc 201/250 show
break
case = DATE
setgad FSearch.gc 1/13 hide
setgad FSearch.gc 21/24 hide
setgad FSearch.gc 101 hide
setgad FSearch.gc 201/250 hide
setgad FSearch.gc 300/350 show
break
case = RES
setgad FSearch.gc 1/13 hide
setgad FSearch.gc 21/24 hide
setgad FSearch.gc 101 show
setgad FSearch.gc 300/350 hide
setgad FSearch.gc 201/250 hide
break
endcase
; redraw FSearch.gc
; NEW - using PARTREDRAW - looks great eh?
partredraw FSearch.gc 4 15 402 124
if $guimode != RES
SetWintitle FSearch.gc 'FSearch by D. Keletsekis'
endif
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
; Parameters
;
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; ------ choose searchpath(s)
BOX 10 20 388 64 in button
gadid 12
CTEXT 20 25 "Search in :" #screen 8 2 0 0001
gadid 1
XTEXTIN 18 37 350 13 "" searchpath sys: 100
gadhelp 'This is the path FSearch will start searching from'
gadid 2
setgad FSearch.gc 5 on ; set cursor to next textin gad
XBUTTON 370 37 18 13 "<" ; choose a searchpath
gadhelp 'Will pop-up a requester to let you choose a path'
gadid 3
ReqFile -1 -1 300 200 'Choose SearchPath:' DIR searchpath $searchpath
update FSearch.gc 2 $searchpath
; ---- filename pattern
CTEXT 21 54 "File name pattern :" #screen 8 2 0 0001
gadid 4
XTEXTIN 17 65 350 13 "" file '#?' 100
gadhelp 'Enter the filepattern wanted - #? means all files'
gadid 5
setgad FSearch.gc 7 on ; set cursor to next textin gad
XBUTTON 370 65 18 13 "<"
gadid 4
guiopen fsearch.ft :fsearch.pat 5
XCHECKBOX 364 24 25 9 "_Include sub-directories" subdirs ALL "" ON
gadhelp 'Check ON to make FSearch recurse through all subdirectories'
gadid 11
; ---- text search
CTEXT 22 99 "Find text :" #screen 8 2 0 0001
gadid 6
XTEXTIN 17 111 371 13 "" findtxt '' 100
gadhelp 'Enter the text you want to find - or nothing for no text search.'
gadid 7
BOX 9 92 389 37 IN BUTTON
gadid 8
XCHECKBOX 360 97 25 9 "Case sensitive" case CS "" OFF
gadhelp 'Check ON to make the search Case Sensitive'
gadid 9
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
; Search results listview
;
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
XLISTVIEW 4 15 400 124 "" resfile "" 10 MULTI
gadhelp "Display search results - Click RMB to save list contents"
gadid 101
gadfont #mono 8 001
; deal with file - if running with dir.gc
ifexists gui dir.gc
; check the first characters
; use popup window to deal with choice, if it's a file
if $resfile[0][4] = '32m'
cutvar resfile[4] cut word 1 resfile
cutvar resfile cut char -4 temp ; cut the csi
ifexists file $resfile
guiload guis:tools/rtn/FilePop \"$fsearch.gc/resfile\"
endif
; or it could be a file but with highlight off
elseif $resfile[0][1] != ' '
and $resfile[0][1] != ''
ifexists file $resfile
guiload guis:tools/rtn/FilePop \"$fsearch.gc/resfile\"
endif
; then it must be a line number.. I use CEd as an editor
elseifexists port rexx_ced
cutvar resfile[4] cut word 1 resfile
sendrexx rexx_ced 'jump to line $resfile'
endif
endif
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
; FSearch settings
;
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; ------- output mode
BOX 23 28 175 71 in button
gadid 201
XRADIO 156 38 18 9 output 2
gadhelp 'Choose where you want the output from FSearch to go to'
gadid 202
rstr 'Output to Gui' gui
RStr 'Output to Shell' cli
; ----------- Output format
XRADIO 156 68 19 9 format 2
gadhelp 'Says it all really..'
gadid 203
RStr 'Show text found' 'VERBOSE'
RStr 'Filenames only' ''
; ------------ Settings - checkboxes
BOX 214 28 176 70 IN BUTTON
gadid 208
XCHECKBOX 350 35 25 9 'Highlight results' highlight "HL" "" ON
gadhelp 'Bask in the glory of colored ansi text - (OS V39)'
gadid 205
XCHECKBOX 350 50 25 9 "Check binary files" nobin "" "NOBIN" ON
gadhelp 'Check ON to make FSearch search binary files'
gadid 211
XCHECKBOX 350 65 25 9 "Show File Path" nopath "" "NOPATH" ON
gadhelp 'Will output filenames using their full path'
gadid 212
XCHECKBOX 350 79 25 9 "Show File Details" details "INFO" "" OFF
gadhelp 'Will also print out file size, date etc'
gadid 213
; ------- help & save settings
XBUTTON 299 119 91 13 "Help.."
gadhelp 'Loads the FSearch.doc - the full Gui4Cli installation is needed'
*FILENAME = '$$win.path\fsearch.readme'
guiload guis:tools/read.gc
guiopen read.gc
gadid 220
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
; DO IT!
;
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; This is where the commandline is formed and launched. The name of
; the variable which holds it is 'options'
XBUTTON 20 143 91 13 "_Search"
gadhelp 'Start the search!'
gadid 501
if $searchpath < ' '
setwintitle FSearch.gc 'Wrong parameters!'
stop
endif
SetWintitle FSearch.gc Searching...
; --- construct the command line
options = '$searchpath '
if $file != '#?'
and $file > ' '
appvar options 'PAT=$file '
endif
if $findtxt > ' '
appvar options 'TXT=\"$findtxt\" $case '
endif
if $size = SIZE
if $min_size > ' '
and $min_size > 0